AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")

include("shared.lua")

function ENT:SpawnFunction(ply, tr) -- Spawn function needed to make it appear on the spawn menu
	if (!tr.HitWorld) then return end
 
	local ent = ents.Create("unarrest_npc") -- Create the entity
	ent:SetPos(tr.HitPos + Vector(0, 0, 5)) -- Set it to spawn 50 units over the spot you aim at when spawning it
	ent:Spawn() -- Spawn it 
		
		return ent -- You need to return the entity to make it work
end

function ENT:Initialize()
	self:SetModel("models/Combine_Soldier.mdl")
	self:SetHullType(HULL_HUMAN);
   	self:SetHullSizeNormal();
   	self:SetSolid( SOLID_BBOX )
   	self:SetMoveType( MOVETYPE_NONE )
	self:SetUseType( SIMPLE_USE )
	self:CapabilitiesAdd( CAP_ANIMATEDFACE || CAP_TURN_HEAD )
	self:DropToFloor()
	self:Give("weapon_real_cs_m4a1")

	MakeNPCText(self.Entity, "Crooked Cop")
end

function ENT:AcceptInput(input, activator, caller, data)
	if activator.DarkRPVars.Arrested then 
		if activator.DarkRPVars.money >= 700 then
			activator:AddMoney(-700)
			activator:Unarrest()
			GAMEMODE:Notify(activator, 4, 4, "I'll help you out of this bind, but you owe me.")
		else
			GAMEMODE:Notify(activator, 1, 4, "Sorry bro, if you ain't got the cash, I can't help ya.")
		end
	else
		GAMEMODE:Notify(activator, 3, 4, "Talk to me if you get in trouble with the law, I'll help you out!")
	end
end